<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta content="en" name="language">
	<title>segment</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link media="screen" href="../docutils-api.css" type="text/css" rel="stylesheet">

</head>

<body>

<div class="banner">
<img src="../images/gm-107x76.png" alt="GraphicMagick logo" width="107" height="76" />
<span class="title">GraphicsMagick</span>
<form action="http://www.google.com/search">
  <input type="hidden" name="domains" value="www.graphicsmagick.org" />
  <input type="hidden" name="sitesearch" value="www.graphicsmagick.org" />
<span class="nowrap"><input type="text" name="q" size="25" maxlength="255" />&nbsp;<input type="submit" name="sa" value="Search" /></span>
</form>
</div>


<div class="navmenu">
<ul>
  <li><a href="../index.html">Home</a></li>
  <li><a href="../project.html">Project</a></li>
  <li><a href="../download.html">Download</a></li>
  <li><a href="../README.html">Install</a></li>
  <li><a href="../Hg.html">Source</a></li>
  <li><a href="../NEWS.html">News</a> </li>
  <li><a href="../utilities.html">Utilities</a></li>
  <li><a href="../programming.html">Programming</a></li>
  <li><a href="../reference.html">Reference</a></li>
</ul>
</div>

<main id="segment">
<h1 class="title">segment</h1>
<p class="subtitle" id="segment-and-image-with-thresholding-using-the-fuzzy-c-means-method">Segment and image with thresholding using the fuzzy c-means method</p>
<div class="contents topic" id="contents">
<p class="topic-title">Contents</p>
<ul class="simple">
<li><p><a class="reference internal" href="#segmentimage" id="id1">SegmentImage</a></p></li>
</ul>
</div>
<section id="segmentimage">
<h1><a class="toc-backref" href="#id1">SegmentImage</a></h1>
<section id="synopsis">
<h2>Synopsis</h2>
<pre class="literal-block">MagickPassFail SegmentImage( <a class="reference external" href="../api/types.html#image">Image</a> *image, const <a class="reference external" href="../api/types.html#colorspacetype">ColorspaceType</a> colorspace,
                             const unsigned int verbose, const double cluster_threshold,
                             const double smoothing_threshold );</pre>
</section>
<section id="description">
<h2>Description</h2>
<p>Method SegmentImage segment an image by analyzing the histograms of the
color components and identifying units that are homogeneous with the fuzzy
c-means technique.</p>
<p>Specify cluster threshold as the number of pixels in each cluster must
exceed the the cluster threshold to be considered valid.  Smoothing
threshold eliminates noise in the second derivative of the histogram.
As the value is increased, you can expect a smoother second derivative.
The default is 1.5.</p>
<p>The format of the SegmentImage method is:</p>
<pre class="literal-block">MagickPassFail SegmentImage( <a class="reference external" href="../api/types.html#image">Image</a> *image, const <a class="reference external" href="../api/types.html#colorspacetype">ColorspaceType</a> colorspace,
                             const unsigned int verbose, const double cluster_threshold,
                             const double smoothing_threshold );</pre>
<dl class="simple">
<dt>image:</dt>
<dd><p>Specifies a pointer to an Image structure;  returned from
ReadImage.</p>
</dd>
<dt>colorspace:</dt>
<dd><p>An unsigned integer value that indicates the colorspace.
Empirical evidence suggests that distances in YUV or YIQ correspond to
perceptual color differences more closely than do distances in RGB
space.  The image is then returned to RGB colorspace after color
reduction.</p>
</dd>
<dt>verbose:</dt>
<dd><p>A value greater than zero prints detailed information about
the identified classes.</p>
</dd>
<dt>cluster_threshold:</dt>
<dd><p>The minimum number of total pixels contained
in a hexahedra before it can be considered valid (expressed as a
percentage of total pixels).  This is used to eliminate seldom
used colors.</p>
</dd>
<dt>smoothing_threshold:</dt>
<dd><p>If the absolute value of a second derivative
point is less than smoothing_threshold then that derivative point
is ignored (i.e. set to 0) while evaluating zero crossings.  This
causes small variations (could be noise) to be ignored.</p>
</dd>
</dl>
</section>
</section>
</main>


<hr class="docutils">
<div class="document">
    <p><a href="../Copyright.html">Copyright</a> © GraphicsMagick Group 2002-2025<!--SPONSOR_LOGO--></p>
</div>

</main>
</body>
</html>
